﻿@model ListViewModel<CommonSearchValues, IQueryable<UserMemo>>
@{
    ViewBag.Title = "健康大事记";
    ViewBag.Back = "/";
}
@*<div data-role="navbar">
    <ul>
        <li>@Html.ActionLink("我的大事记", "MemoList", null, new { @class = "ui-btn-active site-nav-active ui-shadow" })</li>
        <li>@Html.ActionLink("检查单", "MemoEditJcd")</li>
        <li>@Html.ActionLink("备忘录", "MemoEdit")</li>
    </ul>
</div>*@
<a href="#" id="btn_search" style="float: left; display: inline-block;" class="ui-btn ui-icon-search ui-btn-icon-left" data-role="button" data_corners="false" data_icon="search" data_shadow="false" data_wrapperels="span">查询</a>
@Html.ActionLink("检查单", "MemoEditJcd", null, new { style = "float:right;display:inline-block;", data_role = "button", data_corners = "false", data_icon = "plus", data_shadow = "false", data_wrapperels = "span" })
@Html.ActionLink("备忘录", "MemoEdit", null, new { style = "float:right;display:inline-block;", data_role = "button", data_corners = "false", data_icon = "plus", data_shadow = "false", data_wrapperels = "span" })

<div id="searchMemoDiv">
    @using (Html.BeginForm())
    {        
        <fieldset>
            <legend></legend>
            <label>查询内容</label><input name="SearchFrom.V1" id="SearchFrom_V1" type="text" placeholder="请输入标题等文本性内容"
                value="@(Model.SearchFrom != null && !String.IsNullOrEmpty(Model.SearchFrom.V1) ? Model.SearchFrom.V1 : "")" />
            <label>创建时间</label><input name="SearchFrom.V2" id="SearchFrom_V2" type="date" 
                value="@(Model.SearchFrom != null && !String.IsNullOrEmpty(Model.SearchFrom.V2) ? Model.SearchFrom.V2 : "")" />
            <label>至</label><input name="SearchTo.V2" id="SearchTo_V2" type="date" 
                value="@(Model.SearchTo != null && !String.IsNullOrEmpty(Model.SearchTo.V2) ? Model.SearchTo.V2 : "")" />
            <input type="hidden" name="PageIdx" value="1" />
            <p>
                <input type="submit" value="确定" />
            </p>
        </fieldset>
    }
</div>
<ul id="memolist" data-role="listview" data-inset="true" data-corners="false" style="clear: both;">
    @Html.Partial("MemoListPartial", Model)
</ul>
@using (Html.BeginForm("MemoList", "Home", FormMethod.Post, new { id = "pageform" }))
{
    <input type="hidden" id="pageIndex" name="PageIdx" value="@Model.PageIdx" />
    <input type="hidden" id="pageCount" name="PageCount" value="@Model.PageCount" />
    <input name="SearchFrom.V1" id="searchFrom_V1" type="hidden"
           value="@(Model.SearchFrom != null && !String.IsNullOrEmpty(Model.SearchFrom.V1) ? Model.SearchFrom.V1 : "")" />
    <input name="SearchFrom.V2" id="searchFrom_V2" type="hidden" 
           value="@(Model.SearchFrom != null && !String.IsNullOrEmpty(Model.SearchFrom.V2) ? Model.SearchFrom.V2 : "")" />
    <input name="SearchTo.V2" id="searchTo_V2" type="hidden" 
           value="@(Model.SearchTo != null && !String.IsNullOrEmpty(Model.SearchTo.V2) ? Model.SearchTo.V2 : "")" />
    if (Model.PageCount > 1)
    {
    <div class="pagebar">
        @if (Model.PageIdx > 1)
        {
            <a href="javascript:void(0);" class="btn_back" title="上一页" onclick="back();"></a>
        }
        else
        {
            <span class="btn_back"></span>   
        }
        @if (Model.PageIdx < Model.PageCount)
        {
            <a href="javascript:void(0);" class="btn_next" title="下一页" onclick="next();"></a>
        }
        else
        {
            <span class="btn_next"></span>   
        }
    </div>
    }
}
@*@Scripts.Render("~/bundles/jqueryval")*@
@section Scripts{
    <style>
        #searchMemoDiv {
            display: none;            
            background: rgb(249,249,249);
            width: 100%;
            clear: right;
        }

            #searchMemoDiv fieldset {
                padding:1em;
            }
            #searchMemoDiv fieldset legend {
                display: none;
            }

            #searchMemoDiv fieldset label {
                font-weight: bold;
            }

        .timetable {
            width: 98%;
            border: none;
            border-collapse: collapse;
            margin: 0px;
        }

            .timetable tr {
                margin: 0px;
            }

            .timetable td {
                margin: 0px;
                vertical-align: top;
            }

        .timemark {
            width: 70px;
            text-align: right;
            padding: 10px 0px 0px 0px;
        }

            .timemark h2 {
                font: bold 1.6em/1em "微软雅黑" !important;
            }

            .timemark span {
                font: normal 0.8em/1em "微软雅黑";
            }

        .timeline {
            background: url(/Content/Images/vertical-red.png) repeat-y;
            width: 14px;
            padding: 30px 0px 0px 3px;
            /*min-height: 5px;*/
        }

        .sfcard {
            padding: 10px 10px 0px 10px;
        }

            .sfcard a {
                text-decoration: none;
            }

        .greencard {
            background: #a7d30f;
        }

        .graycard {
            background: #ebebe9;
        }

        .ui-listview > .ui-li-static {
            padding: 0 0 0 0.4em;
            border: none;
        }

        .pagebar {
            height: 50px;
            line-height: 50px;
            background: #333;
            padding-left: 50%;
            margin-top: -1em;
        }

            .pagebar a, .pagebar span {
                width: 32px;
                height: 32px;
                line-height: 32px;
                display: block;
                float: left;
                margin: 9px 20px 0px 0px;
            }

        a.btn_back {
            background: url(/Content/images/icon-back-32-fff.png) no-repeat;
        }

        span.btn_back {
            background: url(/Content/images/icon-back-32-999.png) no-repeat;
        }

        a.btn_back, span.btn_back {
            margin-left: -52px;
        }

        a.btn_next {
            background: url(/Content/images/icon-next-32-fff.png) no-repeat;
        }

        span.btn_next {
            background: url(/Content/images/icon-next-32-999.png) no-repeat;
        }
    </style>
    <script type="text/javascript">
        function back() {
            var pageIndex = $('#pageIndex').val();
            pageIndex--;
            $('#pageIndex').val(pageIndex);
            $('#pageform').submit();
        };
        function next() {
            var pageIndex = $('#pageIndex').val();
            pageIndex++;
            $('#pageIndex').val(pageIndex);
            $('#pageform').submit();
        };
        $(function () {
            $('#btn_search').click(function () {
                if ($('#searchMemoDiv').is(':hidden')) {
                    $('#searchMemoDiv').show();
                } else {
                    $('#searchMemoDiv').hide();
                }
            });
        });
    </script>
}